<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="layui/layui/css/layui.css">
    <style>
        body{
            background-color: #999;
        }
        li {
            background-color: #cccccc;
            margin-top: 10px;

        }
        h3{
            margin-top: 20px;
            background-color: #2b542c;
        }
        h4{
            background-color: gold;
        }
    </style>
</head>
<body>
<ul id="LAY_demo2">
    <li>1</li>
</ul>
<div id="box"></div>
</body>
</html>
<script src="layui/layui/layui.js"></script>
<script>
    layui.use('flow', function () {
        var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
        var flow = layui.flow;
        var nub=null;
        var lis = ['<h3 class="">123aa</h3>','<h3 class="">123bb</h3>','<h3 class="">123cc</h3>','<h3 class="">123</h3>','<h3 class="">123</h3>',];
        flow.load({
            elem: '#box' //流加载容器
            , isAuto: false
            , isLazyimg: true
            ,scrollElem:''
            , done: function (page, next) { //加载下一页
                //模拟插入
                /*var lis2 =[];
                for(var i=0;i<2;i++){
                    lis2.push(lis[i]+"<h4>"+i+"</h4>");
                }
                console.log(lis2);
                next(lis2.join(''), page < 4);*/ //假设总页数为 3
                setTimeout(function () {
                    var lis = [];
                    for (var i = 0; i < 2; i++) {
                        lis.push("<li><h1>12</h1><img  lay-src=\'icon/down.jpg'>"+i+"</li>")
                    }
                    console.log(lis);
                    next(lis.join(''), page < 3); //假设总页数为 3
                }, 500);
            },
            end:'德玛西亚永世长存！'
        });
    });
</script>
